using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Data;
using DTO;

using System.Data;

namespace Business
{
    public class ChiTietDoanhThuTheoLoaiPhongService
    {




		//////////////////////////////////////////////////////////

 		                                                         

		//            Enter code your here                      //

		                                                         

		//////////////////////////////////////////////////////////

       static public DataTable ConvertListChiTietDoanhThuTheoLoaiPhongDTOToDataTable( List<ChiTietDoanhThuTheoLoaiPhongDTO> lst)
       {
               DataTable dt = new DataTable();
           dt.Columns.Add( "MaChiTietDoanhThu");
           dt.Columns.Add( "MaDoanhThu");
           dt.Columns.Add( "MaLoaiPhong");
           dt.Columns.Add( "DoanhThu");
           dt.Columns.Add( "TyLe");
           for( int i = 0; i < lst.Count; i ++)
           {
               dt.Rows.Add(
                       lst[i].MaChiTietDoanhThu,      
                       lst[i].MaDoanhThu,      
                       lst[i].MaLoaiPhong,      
                       lst[i].DoanhThu,      
                       lst[i].TyLe      
                   );
           }
               return dt;
       }
        static public int GetIdentity()
        {
            Data.ChiTietDoanhThuTheoLoaiPhongRepository repo = new ChiTietDoanhThuTheoLoaiPhongRepository();
            return repo.GetIdentity();
        }

        static public int Count()
        {
            return ChiTietDoanhThuTheoLoaiPhongRepository.Count();
        }
        public static bool Them(ChiTietDoanhThuTheoLoaiPhongDTO objDTO)
        {
                ChiTietDoanhThuTheoLoaiPhongRepository repo = new ChiTietDoanhThuTheoLoaiPhongRepository();
                return repo.Them(objDTO);
        }

        public static bool Xoa(int MaChiTietDoanhThuTheoLoaiPhong, bool XoaKhoaNgoai=false)
        {
              ChiTietDoanhThuTheoLoaiPhongRepository Repo = new ChiTietDoanhThuTheoLoaiPhongRepository();
              return Repo.Xoa(MaChiTietDoanhThuTheoLoaiPhong,XoaKhoaNgoai);
        }

        public static void CapNhat(ChiTietDoanhThuTheoLoaiPhongDTO objDTO)
        {
            try
            {
                ChiTietDoanhThuTheoLoaiPhongRepository Repo = new ChiTietDoanhThuTheoLoaiPhongRepository();
                Repo.CapNhat(objDTO);
            }
            catch (System.Exception )
            {
            }
        }

        public static List<ChiTietDoanhThuTheoLoaiPhongDTO> LayDanhSach()
        {
            List<ChiTietDoanhThuTheoLoaiPhongDTO> lst = new List<ChiTietDoanhThuTheoLoaiPhongDTO>();
            try
            {
                ChiTietDoanhThuTheoLoaiPhongRepository obj = new ChiTietDoanhThuTheoLoaiPhongRepository();
                lst = obj.LayDanhSach();
            }
            catch (System.Exception )
            {
            }
            return lst;
        }

        static public List<ChiTietDoanhThuTheoLoaiPhongDTO> LayDanhSach(int Start, int Record)
        {
             Data.ChiTietDoanhThuTheoLoaiPhongRepository repo = new ChiTietDoanhThuTheoLoaiPhongRepository();
            return repo.LayDanhSach(Start, Record);
        }

        public static ChiTietDoanhThuTheoLoaiPhongDTO LayTheoMa(int MaChiTietDoanhThuTheoLoaiPhong)
        {
            ChiTietDoanhThuTheoLoaiPhongDTO objDTO = new ChiTietDoanhThuTheoLoaiPhongDTO();
            try
            {
                ChiTietDoanhThuTheoLoaiPhongRepository Repo = new ChiTietDoanhThuTheoLoaiPhongRepository();
                objDTO = Repo.LayTheoMa(MaChiTietDoanhThuTheoLoaiPhong);
            }
            catch (System.Exception )
            {
            }
            return objDTO;
        }

//
//Khoa ngoai DoanhThuTheoLoaiPhong
//
        static public List<ChiTietDoanhThuTheoLoaiPhongDTO> LayDanhSachTheoMaDoanhThuTheoLoaiPhong( int MaDoanhThuTheoLoaiPhong)
        {
             Data.ChiTietDoanhThuTheoLoaiPhongRepository repo = new ChiTietDoanhThuTheoLoaiPhongRepository();
            return repo.LayDanhSachTheoMaDoanhThuTheoLoaiPhong( MaDoanhThuTheoLoaiPhong);
        }

        static public void XoaTheoMaDoanhThuTheoLoaiPhong( int MaDoanhThuTheoLoaiPhong, bool XoaKhoaNgoai=false)
        {
             Data.ChiTietDoanhThuTheoLoaiPhongRepository repo = new ChiTietDoanhThuTheoLoaiPhongRepository();
            repo.XoaTheoMaDoanhThuTheoLoaiPhong( MaDoanhThuTheoLoaiPhong,XoaKhoaNgoai);
        }


//
//Khoa ngoai LoaiPhong
//
        static public List<ChiTietDoanhThuTheoLoaiPhongDTO> LayDanhSachTheoMaLoaiPhong( int MaLoaiPhong)
        {
             Data.ChiTietDoanhThuTheoLoaiPhongRepository repo = new ChiTietDoanhThuTheoLoaiPhongRepository();
            return repo.LayDanhSachTheoMaLoaiPhong( MaLoaiPhong);
        }

        static public void XoaTheoMaLoaiPhong( int MaLoaiPhong, bool XoaKhoaNgoai=false)
        {
             Data.ChiTietDoanhThuTheoLoaiPhongRepository repo = new ChiTietDoanhThuTheoLoaiPhongRepository();
            repo.XoaTheoMaLoaiPhong( MaLoaiPhong,XoaKhoaNgoai);
        }

    }
}

